% For given parameter values, what is the utility from staying at the
% default?

function[value]=utility_optin(alpha,rho,t,m,maxmatch,d)

% Define virtual income above the kink
Zbar=1+(1-t).*maxmatch.*(1+m).*(1-(1/(1+m)));
d_matched = d + m.*min(d,maxmatch);

value = ((rho.*log(d_matched+alpha) + log(1-((1-t)/(1+m)).*d_matched)).*...
    (d<=maxmatch)) +...
    ((rho.*log(d_matched+alpha) + log(Zbar-(1-t).*d_matched))*...
    ((d>maxmatch)));

end